using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;

public class MapManager:MonoBehaviour
{
    static Dictionary<int, City> mCityDict = new Dictionary<int, City>();
    [SerializeField] Troop mTroopPrefab; 
    ContextWin mContextWin; 
    public Transform mTargetCity;

    public static MapManager Instance;
    private void Awake()
    {
        Instance = this;
    }

    private void Start()
    {
        mContextWin = GameObject.FindAnyObjectByType<ContextWin>();
    }

    public Troop CreateTroop()
    {
        var troop = GameObject.Instantiate(mTroopPrefab);
        troop.SetData(MapManager.Instance.mTargetCity);
        return troop;
    }

    public void ShowContext(int city_id)
    {
        mContextWin.SetData(city_id);
        Debug.LogError("111");
        //mContextWin
    }

    public static void AddCity(City c)
    {
        mCityDict[c.mCityInfo.id] = c;
    }

    public static City GetCity(int city_id)
    {
        return mCityDict[city_id];
    }
}
